package com.aooci.ordercat.vo;

import java.text.SimpleDateFormat;
import java.util.Calendar;

import com.aooci.ordercat.domain.Ordercat;
import com.aooci.ordercat.domain.Takeaway;

import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

/**
 * Model class for a Person.
 *
 * @author Marco Jakob
 */
@SuppressWarnings("restriction")
public class TakeawayVo {
	private static SimpleDateFormat timeFormat = new SimpleDateFormat("dd/MM/yyyy - HH:mm");
	private final IntegerProperty id;
	private final StringProperty takingTimeStr;

	/**
	 * Default constructor.
	 */
	public TakeawayVo() {
		this(null);
	}
	
	/**
	 * Constructor with some initial data.
	 * 
	 * @param firstName
	 * @param lastName
	 */
	public TakeawayVo(Takeaway takeaway) {
		this.id = new SimpleIntegerProperty(takeaway.getId());
		if(takeaway.getTakingTimestamp() == null){
			this.takingTimeStr = new SimpleStringProperty("");
		}else{
			this.takingTimeStr = new SimpleStringProperty(timeFormat.format(takeaway.getTakingTimestamp().getTime()));
		}
		
	}

	public String getTakingTimeStr() {
		return takingTimeStr.get();
	}

	public void setTakingTimeStr(String name) {
		this.takingTimeStr.set(name);;
	}
	public StringProperty takingTimeStrProperty() {
		return this.takingTimeStr;
	}

	public int getId() {
		return id.get();
	}

	public void setId(int id) {
		this.id.set(id);;
	}

	public IntegerProperty idProperty(){
		return this.id;
	}
}